#include"threadpool.h"  
int creat_tcp(const char* ip,const char* port)
{
    int sockfd=socket(AF_INET,SOCK_STREAM,0);

    int reause=1;
    int sret_s=setsockopt(sockfd,SOL_SOCKET,SO_REUSEADDR,&reause,sizeof(reause));
    ERROR_CHECK(sret_s,-1,"setsockopt is failed");

    struct sockaddr_in addr;
    addr.sin_family=AF_INET;
    addr.sin_port=htons(atoi(port));
    addr.sin_addr.s_addr=inet_addr(ip);

    int bret=bind(sockfd,(struct sockaddr*)&addr,sizeof(addr));
    ERROR_CHECK(bret,-1,"bind is failed");

    int lret=listen(sockfd,128);
    ERROR_CHECK(lret,-1,"listen is failed");

    return sockfd;
}